// See https://sequelize.org/master/manual/model-basics.html
// for more of what you can do here.
const Sequelize = require('sequelize');
const DataTypes = Sequelize.DataTypes;

module.exports = function (app) {
  const sequelizeClient = app.get('sequelizeClient');
  const vipList = sequelizeClient.define('vip_list', {

    // 头像
    headsculpture: {
      type: DataTypes.STRING,
      allowNull: false,
    },
    // 会员号
    idnumber: {
      type: DataTypes.STRING,
      allowNull: false,
    },
    //  名称
    name: {
      type: DataTypes.STRING,
      allowNull: false,
    },
    // 手机号
    phonenumber: {
      type: DataTypes.STRING,
      allowNull: false,
    },
    // 会员等级
    viplevel: {
      type: DataTypes.STRING,
      allowNull: false,
    },
    // 所属店铺
    Afstore:{
      type: DataTypes.STRING,
      allowNull: false,
    },
    // 余额
    balance: {
      type: DataTypes.STRING,
      allowNull: false,
    },
    // 积分
    integral: {
      type: DataTypes.STRING,
      allowNull: false,
    },
    // 注册时间
    createtime: {
      type: DataTypes.DATE,
      allowNull: false,
    },
    // 活跃时间
    activetime: {
      type: DataTypes.DATE,
      allowNull: false,
    },
    // 状态
    state: {
      type: DataTypes.STRING,
      allowNull: false,
    }
  }, {
    hooks: {
      beforeCount(options) {
        options.raw = true;
      }
    }
  });

  // eslint-disable-next-line no-unused-vars
  vipList.associate = function (models) {
    // Define associations here
    // See https://sequelize.org/master/manual/assocs.html
  };

  return vipList;
};
